package net.oschina.simpleplus.redis;

import net.oschina.simpleplus.redis.JRedisShard;

/**
 *固定数量的redis实例  算法的拓展
 */
public class CustFixedRedisSerJRedisShard extends JRedisShard{

	@Override
	public int shard(byte[] key) {
		return (int) (findUserId(key) % size);
	}
	
	private long findUserId(byte[] key){
		String s = new String(key);
		String[] ss = s.split("_");
		return Long.parseLong(ss[ss.length - 1]);
	}

}
